package com.atstudy.headline.web.app.mapper;

import com.atstudy.headline.entity.Contents;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
* @author A
* @description 针对表【contents(内容基础信息表)】的数据库操作Mapper
* @createDate 2025-06-12 13:55:56
* @Entity com.atstudy.headline.entity.Contents
*/
@Mapper
public interface ContentsMapper extends BaseMapper<Contents> {


    IPage<Contents> pageInfoByContent(IPage<Contents> page);


    //根据id查询内容详情
    Contents getContentById(Integer contentId);


    IPage<Contents> getContentByCategoryId(IPage<Contents> page,Integer parentId);

    // 收藏的内容
    IPage<Contents> getContentByFavorites(IPage<Contents> page,Integer userId);

    @Select("select c.* from contents c where content_id in (select DISTINCT  content_id from content_performance_daily where author_id = #{userId})")
    IPage<Contents> getHistory(IPage<Contents> page,Integer userId);

}




